local sk__luansi = fk.CreateSkill {

  name = "sk__luansi",

  tags = {  },

}



sk__luansi:addEffect("active", {
  name = "sk__luansi",
  anim_type = "control",
  target_num = 2,
  card_num = 0,
  prompt = "#sk__luansi",
  can_use = function(self, player)
    return player:usedSkillTimes(sk__luansi.name, Player.HistoryPhase) == 0
  end,
  card_filter = Util.FalseFunc,
  target_filter = function(self, player, to_select, selected)
    local target = to_select
    if not target:isKongcheng() then
      if #selected == 0 then
        return true
      elseif #selected == 1 then
        return selected[1]:canPindian(target)
      end
    end
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target1 = effect.tos[1]
    local target2 = effect.tos[2]
    local pindian = target1:pindian({target2}, sk__luansi.name)
    for _, p in ipairs({target1, target2, player}) do
      if player.dead then return end
      if pindian.results[target2].winner ~= p and not p.dead then
        if p == player then
          player:drawCards(2, sk__luansi.name)
        elseif not p:isNude() then
          local cards = room:askForCardsChosen(player, p, 1, 2, "he", sk__luansi.name, "#sk__luansi-discard::"..p.id)
          room:throwCard(cards, sk__luansi.name, p, player)
        end
      end
    end
  end,
})

return sk__luansi